#code=gbk
import os

def file_name_to_lower(path):
    for item in os.listdir(path):
        item_lower = item.lower()
        item_file = os.path.join(path, item)
        if os.path.isdir(item_file):
            file_name_to_lower(item_file)
        item_lower_file = os.path.join(path, item_lower)
        try:
            os.rename(item_file, item_lower_file)
        except Exception, e:
            print e
            pass
        
if __name__ == "__main__":
    file_name_to_lower(os.getcwd())
